import {mapGetters} from "vuex"
  export default {
    computed:{
      ...mapGetters('m_cat',['totail'])
    },
    watch:{
      totail:{
        handler(newval){
          
          this.sethuibiao()
        }
      }
    },
   
    onShow() {
      this.sethuibiao()
   
    },
    
    methods: {
      sethuibiao(){
        if(this.totail==0) return uni.removeTabBarBadge({
          index:2
        })
        uni.setTabBarBadge({
          index:2,
          text:this.totail+'', //必须是字符串
          //如果这个函数调用失败可以return出去
          fail() {
            return
          }
        })
      }
    }
  }